<?php
if(!defined('DEDEINC'))
{
	exit("Request Error!");
}

function plus_doctor(&$atts,&$refObj,&$fields)
{
	global $dsql,$_vars,$envs;
	$attlist="row=24,titlelen=24,typeid=0,flag=0";

	FillAtts($atts,$attlist);
	FillFields($atts,$fields,$refObj);
	extract($atts, EXTR_OVERWRITE);

	$totalrow = $row;
	$revalue = '';
	$where = ' 1 ';
	if($flag =='c')
	{
		$where .= 'AND recommend=1 ';
	}
	if($typeid)
	{
		$where .= ' and hospitalid='. int($typeid);
	}
	$equery = "select * from `#@__doctor` where $where limit 0,$totalrow";

	$dsql->SetQuery($equery);
	$dsql->Execute('doc');
	while($dbrow=$dsql->GetArray('doc'))
	{
		$dbrow['fullname'] = $dbrow['name'];
		$dbrow['fullposition'] = $dbrow['position'];
		$dbrow['name'] = cn_substr($dbrow['name'],$titlelen);
		$dbrow['position'] = cn_substr($dbrow['position'],$titlelen);
 		$revalue[] = $dbrow;

	}

	return $revalue;
}
?>